package org.zhangsh.spring.factorybean;

import org.springframework.beans.factory.FactoryBean;
import org.springframework.stereotype.Component;

/**
 * </p>
 *
 * @author zhangsh
 * @version 1.0.0
 * @since 2019-03-27
 */
@Component
public class DemoFactoryBean implements FactoryBean<Integer> {

    public DemoFactoryBean(){
        System.out.println("我是FactoryBean init...");
    }

    @Override
    public Integer getObject() throws Exception {
        System.out.println("FactoryBean(getObject)方法实例化...");
        return 1;
    }

    @Override
    public Class<?> getObjectType() {
        System.out.println("FactoryBean(getObjectType)方法实例化...");
        return Integer.class;
    }

    @Override
    public boolean isSingleton() {
        System.out.println("FactoryBean(isSingleton)方法实例化...");
        return true;
    }
}
